<template>
    <view>
        <view class="topbar" :style="'--color:' + color + ';--rgbcolor:' + rgbcolor">
            <text @tap="topbarFn" :class="'item ' + (t == item.var ? 'active' : '')" :data-var="item.var" v-for="(item, index) in top_nav" :key="index">
                <text class="span">{{ item.title }}</text>

                <text class="b" v-if="item.num > 0">{{ item.num }}</text>
            </text>
        </view>
        <block v-if="t == 'list1' || t == 'list2'">
            <view class="TG_U_box" v-if="LIST.length > 0">
                <block v-for="(dl, idx_list) in LIST" :key="idx_list">
                    <view class="dl" :data-uid="item.id" v-for="(item, idx_dl) in dl" :key="idx_dl">
                        <view class="dt">
                            <image mode="aspectFill" :src="item.photo_s_url"></image>
                        </view>

                        <view class="dd">
                            <view class="h4">
                                <text class="span">{{ item.nickname }}(ID:{{item.id}})</text>
                                <view class="time">{{ item.mob }}</view>
                                <view class="time">{{ item.regtime }}</view>
                            </view>
                        </view>
                        <view class="tgflag">
                            <text :class="'span' + (item.tgflag == 1 ? ' ed' : '')">{{ item.tgflag_str }}</text>
                        </view>

                        <view class="price">
                            <text :class="'span' + (item.tgmoney > 0 && item.tgflag == 1 ? ' ed' : '')">{{ item.tgmoney_str }}</text>
                        </view>
                    </view>
                </block>
            </view>
            <view class="nodata" :style="'--color:' + color + ';--rgbcolor:' + rgbcolor" v-if="nodatabox">
                <image mode="aspectFit" src="/static/res/img/nodata.png"></image>
                <view>
                    <view>～～你还没有发展小伙伴～～</view>
                    <view>通过我分享的分享二维码加入即可成为我的团队成员，发展的我团队，让收益迅速暴增</view>
                    <navigator class="btn5" hoverClass="none" :url="'/hnPages/tg/my_ewm?tguid=' + cook_tg_id">立即去招募</navigator>
                </view>
            </view>
        </block>
        <view class="blank"></view>
    </view>
</template>

<script>
var t;
var a = require('../../@babel/runtime/helpers/defineProperty');
var i = require('../../res/www.a9a.cn.js');
var app = getApp();
var n = 2;
var o = true;
export default {
    data() {
        return {
            nTitle: '我的合伙人',
            t: 'list1',
            color: '',
            rgbcolor: '',
            LIST: [],
            loading_ico_flag: false,
            loading_flag: false,
            loading_str: '',
            nodatabox: false,
            top_nav: '',
            cook_tg_id: '',
            div_login: false,
            mask_class: '',
            div_outlist_box_class: '',
            idx_list: [],
            dl: [],
            idx_dl: 0
        };
    },
    onLoad: function (t) {
        var that = this;
        var n = this;
        var o = t.t;
        app.globalData.get_config('_ZEAI').then(function (t) {
            n.setData({
                color: app.globalData._ZEAI.color,
                rgbcolor: i.c16_rgb(app.globalData._ZEAI.color)
            });
        });
        if (app.globalData.empty(o)) {
            uni.showModal({
                content: '请求参数错误:t',
                confirmColor: n.color,
                confirmText: '朕知道了',
                showCancel: false,
                success: function (t) {
                    uni.navigateBack();
                }
            });
        } else {
            n.setData({
                t: o
            });
            app.globalData.get_openid().then(function (t) {
                that.init();
            });
        }
    },
    onPullDownRefresh: function () {
        var that = this;
        uni.vibrateShort({
            type: 'heavy'
        });
        setTimeout(function () {
            uni.stopPullDownRefresh();
            n = 2;
            o = true;
            that.setData({
                LIST: []
            });
            that.init();
        }, 500);
    },
    onReachBottom: function () {
        var that = this;
        var s = this.LIST;
        if (o) {
            o = false;
            that.setData({
                loading_ico_flag: true
            });
            app.globalData.ajax({
                url: 'tg.php',
                data: {
                    submitok: 'TGTD',
                    p: n,
                    t: that.t,
                    openid: t.openid
                },
                success: function (t) {
                    var e = t.LIST;
                    if (e.length < 1) {
                        that.setData({
                            loading_flag: true,
                            loading_ico_flag: false,
                            loading_str: '已全部加载完成'
                        });
                        return void (o = false);
                    }
                    that.setData(a({}, 'LIST[' + s.length + ']', e));
                    n += 1;
                    o = true;
                }
            });
        }
    },
    onShareAppMessage: function (t) {
        return {
            imageUrl: this.SHARE.imgurl,
            title: this.SHARE.title,
            path: '/hnPages/tg/my'
        };
    },
    onShareTimeline: function () {
        return {
            imageUrl: this.SHARE.imgurl,
            title: this.SHARE.title,
            query: '',
            path: '/hnPages/tg/my'
        };
    },
    methods: {
        topbarFn: function (t) {
            var a = t.currentTarget.dataset.var;
            a = app.globalData.empty(a) ? 'list1' : a;
            this.setData({
                t: a,
                LIST: []
            });
            n = 2;
            o = true;
            this.init();
        },

        init: function () {
            var that = this;
            uni.showNavigationBarLoading();
            t = uni.getStorageSync('COOK_U');
            app.globalData.ajax({
                url: 'tg.php',
                data: {
                    submitok: 'TGTD',
                    t: that.t,
                    openid: t.openid
                },
                success: function (t) {
                    switch ((uni.hideNavigationBarLoading(), t.flag)) {
                        case '1':
                        case 1:
                            uni.setNavigationBarTitle({
                                title: t.nTitle
                            });
                            var e;
                            var o = t.LIST;
                            if (0 == o.length) {
                                that.setData({
                                    nodatabox: true,
                                    top_nav: t.top_nav,
                                    t: t.t,
                                    cook_tg_id: t.cook_tg_id
                                });
                            } else {
                                that.setData(
                                    (a((e = {}), 'LIST[0]', o), a(e, 'nodatabox', false), a(e, 'top_nav', t.top_nav), a(e, 't', t.t), a(e, 'cook_tg_id', t.cook_tg_id), e)
                                );
                            }
                            break;
                        case 'flag0':
                        case 'flag_1':
                        case 'flag2':
                            uni.reLaunch({
                                url: 'reg?t=' + t.flag
                            });
                            break;
                        default:
                            t.this = that;
                            t.url = 'no';
                            i.sorry(t);
                    }
                }
            });
        },

        setloading: function (t, a) {
            'start' == t
                ? this.setData({
                      loading_flag: true,
                      loading_ico_flag: true,
                      loading_str: a
                  })
                : this.setData({
                      loading_flag: false,
                      loading_ico_flag: false,
                      loading_str: a
                  });
        },

        back: function () {
            this.setData({
                div_login: false
            });
        },

        copywxFn: function (t) {
            i.copy_text({
                data: this.OUT.weixin,
                msg: '复制成功'
            });
        },

        mask_closeFn: function (t) {
            var that = this;
            var e = t.currentTarget.dataset.maskid;
            this.setData({
                mask_class: 'alpha100_0',
                div_outlist_box_class: 'div_upAnm2'
            });
            setTimeout(function () {
                var t;
                that.setData((a((t = {}), e, false), a(t, 'mask_class', 'alpha0_100'), a(t, 'div_outlist_box_class', 'div_upAnm1'), t));
            }, 500);
        },

        emptyFn: function () {}
    }
};
</script>
<style>
@import 'tgtd.css';
</style>
